const { now } = require("@stack/utils");

function withTitle() {
  return `Jenkins 发布中 🚧 🚧 🚧`;
}
function withText(text) {
  return {
    tag: "text",
    text,
  };
}
function withUrl(text, href) {
  return {
    tag: "a",
    href,
    text,
  };
}
function withMessages({ name, buildUrl, commit }) {
  return [
    [withText("项目: "), withText(name)],
    [withText("提交: "), withText(`{${commit}}`)],
    [withText("详情: "), withUrl("构建地址", buildUrl)],
    [withText("构建时间: "), withText(now())],
  ];
}
module.exports.withTitle = withTitle;
module.exports.withMessages = withMessages;
